package com.itheima.d2_byte_stream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/*
     目标：使用字节流完成对文件的复制操作。
     数据源
     目的地
 */
public class CopyTest5 {
    public static void main(String[] args) throws Exception {
        long start = System.currentTimeMillis();
        copy1();
        long end = System.currentTimeMillis();
        System.out.println(end-start);


    }
    public static void copy1() throws IOException {
        FileInputStream f = new FileInputStream("C:/Users/86156/Desktop/Snipaste_2024-10-27_16-58-31.png");
        FileOutputStream f2 = new FileOutputStream("yuanzhikong.png");
        int t;
        byte[] bytes = new byte[1024];

        while ((t=f.read(bytes))!=-1){
            f2.write(bytes);
        }

    }
}
